package leetcode.weekly.week296;

//Solution3Test
public class Solution3 {

	// Solution3Test
	public int[] arrayChange(int[] nums, int[][] operations) {
		Integer[] hash = new Integer[1000001];
		for (int i = 0; i < nums.length; i++) {
			hash[nums[i]] = i;
		}
		int m = operations.length;
		for (int i = 0; i < m; i++) {
			int a = operations[i][0];
			int b = operations[i][1];
			int ai = hash[a];
			nums[ai] = b;
			hash[a] = null;
			hash[b] = ai;
		}
		return nums;
	}

}
